package cn.wj.school.app.net.client.context;

import cn.wj.school.common.dto.BaseMsg;
import io.netty.channel.Channel;

/**
 * @Author: yueding
 * @Description: 会话session
 * @Date: Created in 16:27 2018/12/28
 * @Modified By: yueding Copyright(c) cai-inc.com
 */
public class Session {
    /** 网络连接channel */
    private Channel channel;

    private String ipAddr;

    private boolean reconnected;

    public Session() {

    }

    public Session(Channel channel) {
        this.channel = channel;
    }


    /**
     * 向服务端发送消息
     * 
     * @param msg
     */
    public void sendMessage(BaseMsg msg) {
        if (msg == null) {
            return;
        }
        if (channel != null) {
            channel.writeAndFlush(msg);
        }
    }
}
